package HongKongProcurement.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import HongKongProcurement.model.AppVO;
import HongKongProcurement.model.ResultVO;
import HongKongProcurement.service.AppServise;

/**
 * Hello world!
 *
 */

@Controller
public class AppController {

	@Autowired
	private AppServise appServise;

	@RequestMapping("/")
	public String toIndex() {
		return "index";
	}

	@RequestMapping("/app/getResources")
	@ResponseBody
	public ResultVO getResources() {
		ResultVO resultVO = new ResultVO();
		try {
			List<AppVO> appVOs = appServise.getResources();
			resultVO.success(appVOs);
		} catch (Exception e) {
			resultVO.error();
		}
		return resultVO;
	}

}
